﻿/* ######################################## *\
 * ### Copyright (C) 2009 AJ Ravindiran ### *
 * ### HTTP://THEAJ.NET/ <AJ@THEAJ.NET> ### *
\* ######################################## */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AJRavindiran.Jolt.RuneScape.Network.Codecs
{
    /// <summary>
    /// Represents a codec factory which controls incoming and outgoing bytevectors.
    /// </summary>
    public class CodecFactory
    {
        #region Fields
        /// <summary>
        /// The decoder.
        /// </summary>
        private Decoder mDecoder;

        /// <summary>
        /// The encoder.
        /// </summary>
        private Encoder mEncoder;
        #endregion

        #region Constructors
        /// <summary>
        /// Controls incoming and outgoing byte vectors.
        /// </summary>
        public CodecFactory()
        {
            mDecoder = new Decoder(500);
            mEncoder = new Encoder(5000);
        }

        /// <summary>
        /// Controls incoming and outgoing byte vectors.
        /// </summary>
        /// <param name="inCapacity">The capacity of the RS2 Decoder.</param>
        /// <param name="outCapacity">The capacity of the RS2 Encoder.</param>
        public CodecFactory(int inCapacity, int outCapacity)
        {
            mDecoder = new Decoder(inCapacity);
            mEncoder = new Encoder(outCapacity);
        }
        #endregion

        #region Methods
        /// <summary>
        /// Accessor for the decoder.
        /// </summary>
        public Decoder GetDecoder()
        {
            return mDecoder;
        }

        /// <summary>
        /// Accessor for the encoder.
        /// </summary>
        public Encoder GetEncoder()
        {
            return mEncoder;
        }
        #endregion
    }
}
